Set TIFF DPI from volume voxel size#785
Set TIFF DPI from volume voxel size#785SuperOptimizer wants to merge 5 commits intoScrollPrize:mainfrom
Conversation
Derive DPI from voxelsize metadata (25400 µm/inch ÷ voxelSize µm = DPI) and embed it in TIFF output via XRESOLUTION/YRESOLUTION tags. - Add voxelSizeToDpi() helper and optional dpi parameter to writeTiff/TiffWriter - Propagate resolution tags through mergeTiffParts - Set dpi on QuadSurface from tracer/grower voxelsize - Read voxelsize from meta.json in vc_zarr_to_tiff and vc_render_tifxyz Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@SuperOptimizer is attempting to deploy a commit to the scroll Team on Vercel. A member of the Team first needs to authorize it. |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cf63f528fd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| double vs = meta["voxelsize"].get<double>(); | ||
| dpi = voxelSizeToDpi(vs); |
There was a problem hiding this comment.
Scale DPI by selected pyramid level
vc_zarr_to_tiff reads from dataset input/<level> but computes DPI from the base meta.json voxel size without applying the level downsampling factor, so outputs from --level > 0 are tagged with overly high resolution. The repo’s volume docs explicitly define levels as 2x/4x/8x downsampled (volume-cartographer/docs/api/Volume.md, lines 135-137 and 173), so this writes incorrect physical calibration metadata for nonzero levels and can distort downstream measurements.
Useful? React with 👍 / 👎.
| double vs = meta["voxelsize"].get<double>(); | ||
| tifDpi = voxelSizeToDpi(vs); |
There was a problem hiding this comment.
Account for group index when setting render DPI
In vc_render_tifxyz, DPI is derived from raw voxelsize only, but render resolution already changes with group_idx via ds_scale = 2^-group_idx (same file, lines 1258 and 1458), so any run with --group-idx > 0 gets TIFF resolution tags that are too high for the generated pixel grid. This produces inconsistent spatial metadata between rendered outputs from different OME-Zarr levels.
Useful? React with 👍 / 👎.
Summary
voxelsizemetadata (25400 / voxelSize_µm) and embeds it in TIFF output viaTIFFTAG_XRESOLUTION/TIFFTAG_YRESOLUTIONtagsvoxelSizeToDpi()helper and optionaldpiparameter towriteTiff()/TiffWritermergeTiffPartsQuadSurfacefrom tracer/grower voxelsize so all saved segment TIFFs get correct resolutionmeta.jsoninvc_zarr_to_tiffandvc_render_tifxyzTest plan
vc_zarr_to_tiffon a volume with known voxelsize, verify output TIFFs have correct DPI viatiffinfovc_render_tifxyzand verify output TIFFs have DPI set🤖 Generated with Claude Code